# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libbluray

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.5.0
pkgrel=2
pkgdesc='Library to access Blu-Ray disks for video playback (mingw-w64)'
arch=('any')
url='http://www.videolan.org/developers/libbluray.html'
license=('LGPL2.1')
depends=("${MINGW_PACKAGE_PREFIX}-libxml2" "${MINGW_PACKAGE_PREFIX}-freetype")
options=('strip' 'staticlibs')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
source=(ftp://ftp.videolan.org/pub/videolan/libbluray/$pkgver/${_realname}-$pkgver.tar.bz2
        'configure.patch')
md5sums=('04cf15d0f3581a955d3a2ccb9dc06e9e'
         '61c519f55c500648eb28e14d85424cc0')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -Np1 < ../configure.patch
  autoreconf -fi
}

build() {
  mkdir -p ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}

  ../${_realname}-$pkgver/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-examples
    make
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}

  make DESTDIR="$pkgdir" install
}
